﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ZLCMS.Business;
using ZLCMS.Business.DwzFrame;
using ZLCMS.Data.Model;
using NHibernate;
using NHibernate.Criterion;
using DotNet.Common.NHibernateUtil;

namespace ZLCMS.Web.SystemManage.Basics.Operator
{
    public partial class ViewOperator : System.Web.UI.Page
    {
        protected FrameHelper _framePage;

        protected UserInfo _userDB;
        protected UrUserRole _roleDb;

        protected void Page_Load(object sender, EventArgs e)
        {
            //初始化DWZ控件
            _framePage = new FrameHelper(this);

            //初始化全局变量值
            InitializeGlobalValue();

            //初始化控件值
            InitializeContent();

        }

        protected void InitializeGlobalValue()
        {
            int id;

            try
            {
                id = int.Parse(Request["uid"]);

                using (ISession session = SessionFactoryHelper.CreateSession())
                {
                    _userDB = session.Get<UserInfo>(id);

                    if (_userDB == null)
                    {
                        throw new Exception("找不到对应信息.");
                    }
                    _roleDb = session.CreateCriteria<UrUserRole>().Add(Expression.Eq("UserCode", _userDB.UserAccount)).UniqueResult<UrUserRole>();
                }
            }
            catch (System.Exception ex)
            {
                _framePage.Alert(new ReturnCode() { statusCode = 300, message = "操作出错-" + ex.Message });
                return;
            }
        }

        protected void InitializeContent()
        {
            //页面控件数据

            //页面控件值
            if (!IsPostBack)
            {
            }
        }
    }
}
